package com.sam.di.module;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.jess.arms.di.scope.ActivityScope;

import dagger.Module;
import dagger.Provides;

import com.sam.mvp.contract.HomeContract;
import com.sam.mvp.entity.HomeEnity;
import com.sam.mvp.entity.User;
import com.sam.mvp.helper.HomeAdapterHelper;
import com.sam.mvp.model.HomeModel;
import com.sam.mvp.ui.adapter.HomeAdapter;

import java.util.ArrayList;
import java.util.List;


@Module
public class HomeModule {

    private HomeContract.View view;

    /**
     * 构建HomeModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public HomeModule(HomeContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    HomeContract.View provideHomeView() {
        return this.view;
    }

    @ActivityScope
    @Provides
    HomeContract.Model provideHomeModel(HomeModel model) {
        return model;
    }


    @ActivityScope
    @Provides
    HomeAdapter provideAdapter() {
        return new HomeAdapter();
    }

    @ActivityScope
    @Provides
    List<HomeEnity> provideHomeList() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    RecyclerView.LayoutManager provideLayoutManager() {
//        return new GridLayoutManager(view.getActivity(),2);
        return new LinearLayoutManager(view.getActivity());
    }




}